package smedi.ismedi.web.bff.controller.inmail;

import com.smedi.ismedi.constructionproject.api.dto.request.ProjectPageQueryRequest;
import com.smedi.ismedi.constructionproject.api.dto.response.resp.ProjectDetailResp;
import com.smedi.ismedi.constructionproject.api.feign.RemoteConstructionProjectFeignApi;
import com.smedi.ismedi.file.dto.response.FileInfoResponse;
import com.smedi.ismedi.file.feign.RemoteFileFeignApi;
import com.smedi.ismedi.inmail.api.dto.request.*;
import com.smedi.ismedi.inmail.api.dto.response.*;
import com.smedi.ismedi.inmail.api.feign.RemoteOverviewFeignApi;
import com.smedi.ismedi.web.starter.common.PaginationData;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import smedi.ismedi.web.bff.controller.inmail.dto.ProjectOverviewDetailRequest;
import smedi.ismedi.web.bff.controller.inmail.dto.VideoMonitorOrganizationOverviewDetailRequest;
import smedi.ismedi.web.bff.infrastructure.constant.ConstantField;
import smedi.ismedi.web.bff.infrastructure.util.FileHelper;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static smedi.ismedi.web.bff.infrastructure.constant.ConstantField.EpcTypeEnum.*;
import static smedi.ismedi.web.bff.infrastructure.constant.ConstantField.MonitorTypeEnum.DEFAULT_TYPE;
import static smedi.ismedi.web.bff.infrastructure.constant.ConstantField.MonitorTypeEnum.NOT_INSTALLED;
import static smedi.ismedi.web.bff.infrastructure.constant.ConstantField.ProjectStatusEnum.*;

/**
 * 通知公告BFF
 *
 * @author jiangqinxuan
 * @date 2021/08/03
 */
@Slf4j
@Api(value = "安全统计", tags = {"安全统计"})
@RequestMapping(value = "/webbff/v1/overview")
@RestController
@RequiredArgsConstructor
public class OverviewController {
    private final RemoteOverviewFeignApi remoteOverviewFeignApi;

    private final RemoteConstructionProjectFeignApi remoteConstructionProjectFeignApi;

    private final RemoteFileFeignApi fileFeignApi;

    @Value("${fdfs.service.address.in}")
    private String FDFS_SERVICE_ADDRESS_IN;

    /**
     * 项目统计
     *
     * @return ResponseData<ProjectStatisticsByRegionResponse>
     */
    @ApiOperation(httpMethod = "POST", value = "项目统计")
    @PostMapping(value = "/project")
    ResponseData<ProjectOverviewPaginationData> getProjectOverviewPage(@Validated @RequestBody ProjectOverviewPageRequest projectOverviewPageRequest) {
        return remoteOverviewFeignApi.getProjectOverviewPage(projectOverviewPageRequest);
    }

    /**
     * 项目统计（弹窗）
     *
     * @return ResponseData<PaginationData < ProjectDetailResp>>
     */
    @ApiOperation(httpMethod = "POST", value = "项目统计（弹窗）")
    @PostMapping(value = "/project/detail")
    ResponseData<PaginationData<ProjectDetailResp>> getProjectOverviewDetail(@Validated @RequestBody ProjectOverviewDetailRequest projectOverviewDetailRequest) {
        if (projectOverviewDetailRequest.getType().equals("totalNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(projectOverviewDetailRequest.getCurrent())
                    .size(projectOverviewDetailRequest.getSize())
                    .organizationShortName(projectOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (projectOverviewDetailRequest.getType().equals("notStartedNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(projectOverviewDetailRequest.getCurrent())
                    .size(projectOverviewDetailRequest.getSize())
                    .projectStatus(NOT_STARTED.name())
                    .organizationShortName(projectOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (projectOverviewDetailRequest.getType().equals("constructingNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(projectOverviewDetailRequest.getCurrent())
                    .size(projectOverviewDetailRequest.getSize())
                    .projectStatus(CONSTRUCTING.name())
                    .organizationShortName(projectOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (projectOverviewDetailRequest.getType().equals("stoppedNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(projectOverviewDetailRequest.getCurrent())
                    .size(projectOverviewDetailRequest.getSize())
                    .projectStatus(STOPPED.name())
                    .organizationShortName(projectOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (projectOverviewDetailRequest.getType().equals("finishedNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(projectOverviewDetailRequest.getCurrent())
                    .size(projectOverviewDetailRequest.getSize())
                    .projectStatus(FINISHED.name())
                    .organizationShortName(projectOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (projectOverviewDetailRequest.getType().equals("completedNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(projectOverviewDetailRequest.getCurrent())
                    .size(projectOverviewDetailRequest.getSize())
                    .projectStatus(COMPLETED.name())
                    .organizationShortName(projectOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (projectOverviewDetailRequest.getType().equals("selfSupportNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(projectOverviewDetailRequest.getCurrent())
                    .size(projectOverviewDetailRequest.getSize())
                    .epcType(SELF_SUPPORT.name())
                    .organizationShortName(projectOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (projectOverviewDetailRequest.getType().equals("consortiumNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(projectOverviewDetailRequest.getCurrent())
                    .size(projectOverviewDetailRequest.getSize())
                    .epcType(CONSORTIUM.name())
                    .organizationShortName(projectOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (projectOverviewDetailRequest.getType().equals("selfSupportConsortiumNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(projectOverviewDetailRequest.getCurrent())
                    .size(projectOverviewDetailRequest.getSize())
                    .epcType(SELF_SUPPORT_CONSORTIUM.name())
                    .organizationShortName(projectOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        return null;
    }

    /**
     * 项目统计导出
     */
    @ApiOperation(httpMethod = "POST", value = "项目统计导出")
    @PostMapping(value = "/project/export")
    ResponseData<Boolean> exportProjectOverview(@Validated @RequestBody ProjectOverviewListRequest projectOverviewListRequest, HttpServletResponse response) {
        String signKey = remoteOverviewFeignApi.exportProjectOverview(projectOverviewListRequest).getData();
        FileInfoResponse fileInfoResponse = fileFeignApi.getFileInfo(signKey).getData();
        FileHelper.downloadFile(FDFS_SERVICE_ADDRESS_IN, fileInfoResponse.getStorageGroup(), fileInfoResponse.getPath(), fileInfoResponse.getName(), response);

        return new ResponseData<>().success(true);
    }

    /**
     * 安全检查（主体院）统计
     *
     * @return ResponseData<SafetyCheckOrgOverviewPaginationData>
     */
    @ApiOperation(httpMethod = "POST", value = "安全检查统计（主体院）")
    @PostMapping(value = "/safety-check/organization")
    ResponseData<SafetyCheckOrgOverviewPaginationData> getSafetyCheckOrganizationOverviewPage(@Validated @RequestBody SafetyCheckOrganizationOverviewPageRequest safetyCheckOrganizationOverviewPageRequest) {
        return remoteOverviewFeignApi.getSafetyCheckOrganizationOverviewPage(safetyCheckOrganizationOverviewPageRequest);
    }

    /**
     * 安全检查（主体院）统计导出
     *
     * @return url
     */
    @ApiOperation(httpMethod = "POST", value = "安全检查统计（主体院）导出")
    @PostMapping(value = "/safety-check/organization/export")
    ResponseData<Boolean> exportSafetyCheckOrganizationOverview(@Validated @RequestBody SafetyCheckOrganizationOverviewListRequest safetyCheckOrganizationOverviewListRequest, HttpServletResponse response) {
        String signKey = remoteOverviewFeignApi.exportSafetyCheckOrganizationOverview(safetyCheckOrganizationOverviewListRequest).getData();
        FileInfoResponse fileInfoResponse = fileFeignApi.getFileInfo(signKey).getData();
        FileHelper.downloadFile(FDFS_SERVICE_ADDRESS_IN, fileInfoResponse.getStorageGroup(), fileInfoResponse.getPath(), fileInfoResponse.getName(), response);

        return new ResponseData<>().success(true);
    }

    /**
     * 安全检查（项目）统计
     *
     * @return ResponseData<PaginationData < SafetyCheckOverviewResponse>>
     */
    @ApiOperation(httpMethod = "POST", value = "安全检查统计（项目）")
    @PostMapping(value = "/safety-check/project")
    ResponseData<PaginationData<SafetyCheckProjectOverviewResponse>> getSafetyCheckProjectOverviewPage(@Validated @RequestBody SafetyCheckProjectOverviewPageRequest safetyCheckProjectOverviewPageRequest) {
        return remoteOverviewFeignApi.getSafetyCheckProjectOverviewPage(safetyCheckProjectOverviewPageRequest);
    }

    /**
     * 安全检查（项目）统计导出
     *
     * @return url
     */
    @ApiOperation(httpMethod = "POST", value = "安全检查统计（项目）导出")
    @PostMapping(value = "/safety-check/project/export")
    ResponseData<Boolean> exportSafetyCheckProjectOverview(@Validated @RequestBody SafetyCheckProjectOverviewListRequest safetyCheckProjectOverviewListRequest, HttpServletResponse response) {
        String signKey = remoteOverviewFeignApi.exportSafetyCheckProjectOverview(safetyCheckProjectOverviewListRequest).getData();
        FileInfoResponse fileInfoResponse = fileFeignApi.getFileInfo(signKey).getData();
        FileHelper.downloadFile(FDFS_SERVICE_ADDRESS_IN, fileInfoResponse.getStorageGroup(), fileInfoResponse.getPath(), fileInfoResponse.getName(), response);

        return new ResponseData<>().success(true);
    }

    /**
     * 视频监控统计
     *
     * @return ResponseData<VideoMonitorOrgOverviewPaginationData>
     */
    @ApiOperation(httpMethod = "POST", value = "视频监控(主体院)统计(弹窗)")
    @PostMapping(value = "/video-monitor/organization/detail")
    ResponseData<PaginationData<ProjectDetailResp>> getVideoMonitorOrganizationOverviewDetail(@Validated @RequestBody VideoMonitorOrganizationOverviewDetailRequest videoMonitorOrganizationOverviewDetailRequest) {
        if (videoMonitorOrganizationOverviewDetailRequest.getType().equals("needNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(videoMonitorOrganizationOverviewDetailRequest.getCurrent())
                    .size(videoMonitorOrganizationOverviewDetailRequest.getSize())
                    .projectStatuses(new ArrayList<>(Arrays.asList(NOT_STARTED.name(), CONSTRUCTING.name(), STOPPED.name())))
                    .monitorTypes(new ArrayList<>(Arrays.asList(DEFAULT_TYPE.name(), ConstantField.MonitorTypeEnum.STOPPED.name())))
                    .organizationShortName(videoMonitorOrganizationOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (videoMonitorOrganizationOverviewDetailRequest.getType().equals("defaultNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(videoMonitorOrganizationOverviewDetailRequest.getCurrent())
                    .size(videoMonitorOrganizationOverviewDetailRequest.getSize())
                    .projectStatuses(new ArrayList<>(Arrays.asList(NOT_STARTED.name(), CONSTRUCTING.name(), STOPPED.name())))
                    .monitorType(DEFAULT_TYPE.name())
                    .organizationShortName(videoMonitorOrganizationOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (videoMonitorOrganizationOverviewDetailRequest.getType().equals("notInstallNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(videoMonitorOrganizationOverviewDetailRequest.getCurrent())
                    .size(videoMonitorOrganizationOverviewDetailRequest.getSize())
                    .projectStatuses(new ArrayList<>(Arrays.asList(NOT_STARTED.name(), CONSTRUCTING.name(), STOPPED.name())))
                    .monitorType(NOT_INSTALLED.name())
                    .organizationShortName(videoMonitorOrganizationOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (videoMonitorOrganizationOverviewDetailRequest.getType().equals("stoppedNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(videoMonitorOrganizationOverviewDetailRequest.getCurrent())
                    .size(videoMonitorOrganizationOverviewDetailRequest.getSize())
                    .projectStatuses(new ArrayList<>(Arrays.asList(NOT_STARTED.name(), CONSTRUCTING.name(), STOPPED.name())))
                    .monitorType(ConstantField.MonitorTypeEnum.STOPPED.name())
                    .organizationShortName(videoMonitorOrganizationOverviewDetailRequest.getOrganizationShortName())
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (videoMonitorOrganizationOverviewDetailRequest.getType().equals("existNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(videoMonitorOrganizationOverviewDetailRequest.getCurrent())
                    .size(videoMonitorOrganizationOverviewDetailRequest.getSize())
                    .projectStatuses(new ArrayList<>(Arrays.asList(NOT_STARTED.name(), CONSTRUCTING.name(), STOPPED.name())))
                    .monitorTypes(new ArrayList<>(Arrays.asList(DEFAULT_TYPE.name(), ConstantField.MonitorTypeEnum.STOPPED.name())))
                    .organizationShortName(videoMonitorOrganizationOverviewDetailRequest.getOrganizationShortName())
                    .hasVideoMonitor(true)
                    .byAuthenticationFilter(true)
                    .build());
        }
        if (videoMonitorOrganizationOverviewDetailRequest.getType().equals("needButNoExistNum")) {
            return remoteConstructionProjectFeignApi.getProjectDetailPage(ProjectPageQueryRequest
                    .builder()
                    .current(videoMonitorOrganizationOverviewDetailRequest.getCurrent())
                    .size(videoMonitorOrganizationOverviewDetailRequest.getSize())
                    .monitorTypes(new ArrayList<>(Arrays.asList(DEFAULT_TYPE.name(), ConstantField.MonitorTypeEnum.STOPPED.name())))
                    .projectStatuses(new ArrayList<>(Arrays.asList(NOT_STARTED.name(), CONSTRUCTING.name(), STOPPED.name())))
                    .organizationShortName(videoMonitorOrganizationOverviewDetailRequest.getOrganizationShortName())
                    .hasVideoMonitor(false)
                    .byAuthenticationFilter(true)
                    .build());
        }
        return null;
    }

    /**
     * 视频监控统计
     *
     * @return ResponseData<VideoMonitorOrgOverviewPaginationData>
     */
    @ApiOperation(httpMethod = "POST", value = "视频监控(主体院)统计")
    @PostMapping(value = "/video-monitor/organization")
    ResponseData<VideoMonitorOrgOverviewPaginationData> getVideoMonitorOrganizationOverviewPage(@Validated @RequestBody VideoMonitorOrganizationOverviewPageRequest videoMonitorOrganizationOverviewPageRequest) {
        return remoteOverviewFeignApi.getVideoMonitorOrganizationOverviewPage(videoMonitorOrganizationOverviewPageRequest);
    }

    /**
     * 视频监控统计导出
     *
     * @return url
     */
    @ApiOperation(httpMethod = "POST", value = "视频监控(主体院)统计导出")
    @PostMapping(value = "/video-monitor/organization/export")
    ResponseData<Boolean> exportVideoMonitorOrganizationOverview(@Validated @RequestBody VideoMonitorOrganizationOverviewListRequest videoMonitorOrganizationOverviewListRequest, HttpServletResponse response) {
        String signKey = remoteOverviewFeignApi.exportVideoMonitorOrganizationOverview(videoMonitorOrganizationOverviewListRequest).getData();
        FileInfoResponse fileInfoResponse = fileFeignApi.getFileInfo(signKey).getData();
        FileHelper.downloadFile(FDFS_SERVICE_ADDRESS_IN, fileInfoResponse.getStorageGroup(), fileInfoResponse.getPath(), fileInfoResponse.getName(), response);

        return new ResponseData<>().success(true);
    }

    /**
     * 视频监控统计
     *
     * @return ResponseData<PaginationData < VideoMonitorOverviewResponse>>
     */
    @ApiOperation(httpMethod = "POST", value = "视频监控(项目)统计")
    @PostMapping(value = "/video-monitor/project")
    ResponseData<PaginationData<VideoMonitorProjectOverviewResponse>> getVideoMonitorProjectOverviewPage(@Validated @RequestBody VideoMonitorProjectOverviewPageRequest videoMonitorProjectOverviewPageRequest) {
        return remoteOverviewFeignApi.getVideoMonitorProjectOverviewPage(videoMonitorProjectOverviewPageRequest);
    }

    /**
     * 视频监控统计导出
     *
     * @return url
     */
    @ApiOperation(httpMethod = "POST", value = "视频监控(项目)统计导出")
    @PostMapping(value = "/video-monitor/project/export")
    ResponseData<Boolean> exportVideoMonitorProjectOverview(@Validated @RequestBody VideoMonitorProjectOverviewListRequest videoMonitorProjectOverviewListRequest, HttpServletResponse response) {
        String signKey = remoteOverviewFeignApi.exportVideoMonitorProjectOverview(videoMonitorProjectOverviewListRequest).getData();
        FileInfoResponse fileInfoResponse = fileFeignApi.getFileInfo(signKey).getData();
        FileHelper.downloadFile(FDFS_SERVICE_ADDRESS_IN, fileInfoResponse.getStorageGroup(), fileInfoResponse.getPath(), fileInfoResponse.getName(), response);

        return new ResponseData<>().success(true);
    }

    /**
     * 项目级别统计
     *
     * @return ResponseData<PaginationData < ProjectPersonOverViewResponse>>
     */
    @ApiOperation(httpMethod = "POST", value = "项目级别统计 主体院")
    @PostMapping(value = "/project/level")
    ResponseData<PaginationData<ProjectPersonOverViewResponse>> projectLevelOverviewPage(@Validated @RequestBody ProjectOverviewPageRequest projectOverviewPageRequest) {
        return remoteOverviewFeignApi.projectLevelOverviewPage(projectOverviewPageRequest);
    }

    /**
     * 项目级别统计
     *
     * @return ResponseData<PaginationData < ProjectPersonOverViewResponse>>
     */
    @ApiOperation(httpMethod = "POST", value = "岗位人员统计 项目")
    @PostMapping(value = "/project/job")
    ResponseData<PaginationData<ProjectPostOverViewResponse>> projectPostOverviewPage(@Validated @RequestBody ProjectOverviewPageRequest projectOverviewPageRequest) {
        return remoteOverviewFeignApi.projectPostOverviewPage(projectOverviewPageRequest);
    }

    /**
     * 项目级别统计 岗位人员列表 弹窗
     */
    @ApiOperation(httpMethod = "GET", value = "岗位人员列表 弹窗 项目")
    @GetMapping(value = "/project/job/list")
    ResponseData<List<ProjectJobPersonResponse>> projectJobPersonList(@RequestParam Long projectId, @RequestParam String projectJob) {
        return remoteOverviewFeignApi.projectJobPersonList(projectId, projectJob);
    }

    /**
     * 项目级别统计 岗位人员查看列表 查看
     */
    @ApiOperation(httpMethod = "GET", value = "岗位人员 查看 项目")
    @GetMapping(value = "/project/job/person")
    ResponseData<ProjectPostPersonOverViewResponse> projectPostPersonList(@RequestParam Long projectId) {
        return remoteOverviewFeignApi.projectPostPersonList(projectId);
    }

    /**
     * 钉钉相关数据更新
     *
     * @return ResponseData<Boolean>
     */
    @ApiOperation(httpMethod = "POST", value = "钉钉相关数据更新")
    @PostMapping(value = "/ding-talk/data/update")
    ResponseData<Boolean> updateDingTalkData() {
        return remoteOverviewFeignApi.updateDingTalkData();
    }

    /**
     * 主体院考勤信息
     */
    @ApiOperation(httpMethod = "POST", value = "主体院钉钉考勤统计")
    @PostMapping(value = "/ding-attendance/org/page")
    ResponseData<PaginationData<DingAttendanceOverViewResponse>> getDingAttendancePaginationDataResponseData(@Validated @RequestBody DingAttendanceOverViewPageRequest dingAttendanceOverViewPageRequest) {
        return remoteOverviewFeignApi.getDingAttendancePaginationDataResponseData(dingAttendanceOverViewPageRequest);
    }

    /**
     * 项目考勤信息
     */
    @ApiOperation(httpMethod = "POST", value = "项目钉钉考勤统计")
    @PostMapping(value = "/ding-attendance/project/page")
    ResponseData<PaginationData<DingAttendanceProjectOverViewResponse>> getDingAttendanceProjectPaginationDataResponseData(@Validated @RequestBody DingAttendanceProjectOverViewPageRequest dingAttendanceProjectOverViewPageRequest) {
        return remoteOverviewFeignApi.getDingAttendanceProjectPaginationDataResponseData(dingAttendanceProjectOverViewPageRequest);
    }

    /**
     * 单个项目考勤信息详情
     */
    @ApiOperation(httpMethod = "POST", value = "项目钉钉考勤详情")
    @PostMapping(value = "/ding-attendance/project")
    ResponseData<DingDingAttendanceProjectResponse> getProjectDetail(@Validated @RequestBody DingDingProjectRequest dingDingProjectRequest) {
        return remoteOverviewFeignApi.getProjectDetail(dingDingProjectRequest);
    }

    /**
     * 主体院考勤信息导出
     */
    @ApiOperation(httpMethod = "POST", value = "主体院钉钉考勤信息导出")
    @PostMapping(value = "/ding-attendance/org/export")
    ResponseData<Boolean> exportOrgAttendance(@RequestBody DingAttendanceOrgExportRequest request, HttpServletResponse response) {
        String signKey = remoteOverviewFeignApi.exportOrgAttendance(request).getData();
        FileInfoResponse fileInfoResponse = fileFeignApi.getFileInfo(signKey).getData();
        FileHelper.downloadFile(FDFS_SERVICE_ADDRESS_IN, fileInfoResponse.getStorageGroup(), fileInfoResponse.getPath(), fileInfoResponse.getName(), response);

        return new ResponseData<>().success(true);
    }

    /**
     * 项目钉钉考勤信息导出
     */
    @ApiOperation(httpMethod = "POST", value = "项目钉钉考勤信息导出")
    @PostMapping(value = "/ding-attendance/project/export")
    ResponseData<Boolean> exportProjectAttendance(@RequestBody DingAttendanceProjectExportRequest request, HttpServletResponse response) {
        String signKey = remoteOverviewFeignApi.exportProjectAttendance(request).getData();
        FileInfoResponse fileInfoResponse = fileFeignApi.getFileInfo(signKey).getData();
        FileHelper.downloadFile(FDFS_SERVICE_ADDRESS_IN, fileInfoResponse.getStorageGroup(), fileInfoResponse.getPath(), fileInfoResponse.getName(), response);

        return new ResponseData<>().success(true);
    }

    /**
     * 不合格项目详情
     */
    @ApiOperation(httpMethod = "POST", value = "不合格项目详情")
    @PostMapping(value = "/ding-attendance/project/detail/page")
    ResponseData<PaginationData<DingDingAttendanceProjectDetailResponse>> projectDetailPage(@Validated @RequestBody DingProjectDetailPageRequest request) {
        return remoteOverviewFeignApi.projectDetailPage(request);
    }

    /**
     * 不合格人员详情
     */
    @ApiOperation(httpMethod = "POST", value = "不合格人员详情")
    @PostMapping(value = "/ding-attendance/people/detail/page")
    ResponseData<PaginationData<DingDingAttendancePeopleDetailResponse>> peopleDetailPage(@Validated @RequestBody DingProjectDetailPageRequest request) {
        return remoteOverviewFeignApi.peopleDetailPage(request);
    }
}
